package com.fjec.paid.schedule.handler;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fjec.paid.entity.BizDistribution;
import com.fjec.paid.service.IBizDistributionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Component
@Slf4j
public class DivideHandler {

    @Resource
    private IBizDistributionService bizDistributionService;

    public void handle(int limit, int minutes) {
        List<BizDistribution> distributions = bizDistributionService.list(new QueryWrapper<BizDistribution>()
                .in("DistStatus", 0, 3));
        distributions.forEach(d -> bizDistributionService.doDivide(d));
    }
}
